<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich">

    <h:head>
        <title>Goalkeeper E-Shop</title>
        <h:outputStylesheet library="css" name="style.css" />
    </h:head>
    <h:body>

        <ui:composition template="template.xhtml">
            <ui:define name="content">
                <br/>
                <h:outputText styleClass="h1" value="#{msg.insertProduct}" />
                <br/>
                <br/>
                <h:messages styleClass="h2" />
                <br/>
                <h:form>
                    <h:panelGrid columns="2">
                        <h:outputText styleClass="h3" value="#{msg.insertCategory}"/>
                        <h:selectOneMenu value="#{insertProductBacking.product.category}">
                            <f:selectItems value="#{shopData.categoryList}" />
                            <f:converter converterId="at.fhj.swd10.eshop.converter.categoryConverter" />
                        </h:selectOneMenu>

                        <h:outputText styleClass="h3" value="#{msg.insertLabel}"/>
                        <h:selectOneMenu value="#{insertProductBacking.product.label}">
                            <f:selectItems value="#{shopData.labelList}" />
                            <f:converter converterId="at.fhj.swd10.eshop.converter.labelConverter" />
                        </h:selectOneMenu>

                        <h:outputText styleClass="h3" value="#{msg.insertName}"/>
                        <h:inputText value="#{insertProductBacking.product.name}" required="true" requiredMessage="#{msg.insertError}" />

                        <h:outputText styleClass="h3" value="#{msg.insertDescription}"/>
                        <h:inputTextarea value="#{insertProductBacking.product.description}" required="true" requiredMessage="#{msg.insertError}">
                            <f:validateLength maximum="255" />
                        </h:inputTextarea>

                        <h:outputText styleClass="h3" value="#{msg.insertSize}"/>
                        <h:inputText value="#{insertProductBacking.product.size}" required="true" requiredMessage="#{msg.insertError}" />

                        <h:outputText styleClass="h3" value="#{msg.insertPrice}"/>
                        <h:inputText value="#{insertProductBacking.product.price}" required="true" requiredMessage="#{msg.insertError}">
                            <f:converter converterId="javax.faces.Float" />
                        </h:inputText>

                        <h:outputText styleClass="h3" value="#{msg.insertDate}"/>
                        <rich:calendar value="#{insertProductBacking.product.addToShopDate}" locale="#{languageBean.currentLocale}" datePattern="dd.MM.yy HH:mm:ss" />

                        <h:outputText styleClass="h3" value="#{msg.insertImage}"/>
                        <h:inputText value="#{insertProductBacking.product.image}" required="true" requiredMessage="#{msg.insertError}" />                                   
                    </h:panelGrid>
                    <br/>
                    <h:commandButton action="#{insertProductBacking.insertProduct}" value="#{msg.insertButton}" />
                </h:form>
                <br/>
                <br/>
            </ui:define>
        </ui:composition>

    </h:body>
</html>
